import { createRouter, createWebHashHistory } from 'vue-router'
import GadgetHome from '@/views/home/GadgetHome.vue'

export const routes = [
  {
    path: '/',
    name: 'index',
    component: GadgetHome,
    meta: {
      title: '首页'
    }
  },
  {
    path: '/color',
    name: 'color',
    component: () => import('../views/LongColor.vue'),
    meta: {
      title: '龙龙配色'
    }
  },
  {
    path: '/poker',
    name: 'poker',
    component: () => import('../views/poker/PokerMove.vue'),
    meta: {
      title: '扑克'
    }
  },
  {
    path: '/money',
    name: 'money',
    component: () => import('../views/MoneyCloud.vue'),
    meta: {
      title: '掉钱'
    }
  }
]
const router = createRouter({
  history: createWebHashHistory(),
  routes
})
router.beforeEach((to) => {
  if (to.meta.title) {
    document.title = to.meta.title as string
  }
})
export default router
